﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Jogo_Grupo2.Elementos
{
    class Barricada : Objeto2D
    {

        public float energia = 100f;

        public int spriteWidth;
        public int spriteHeight;

        public bool invulneravel = true;

        SpriteEffects invertido = SpriteEffects.None;
        Rectangle spriteRect;

        enum statusBarricada
        {
            inteira,danificada,destruida,

        }
        public Barricada(Texture2D textura, Vector2 posicao,SpriteEffects spriteEffects)
            : base(textura, posicao)
        {



        }
        public void perderEnergiaBarricada()
        {
            int timerDano = 0;
            if (this != null)
            {
                invulneravel = false;
                Console.WriteLine("energia: " + energia);


                if (timerDano == 3)
                {
                    energia -= 0.1f;
                    

                }
                else if (timerDano == 0)
                {
                    timerDano++;
                    this.energia -= 0.1f;
                }

            }
        }
        public bool verificarDestruiuBarricada()
        {
            if (this.energia == 0)
            {
                return true;
            }

            else
                return false;
        }


        public override void Update(GameTime gameTime)
        {
            if (this!=null)
            {

                if (energia == 0)
                {
                    //return null;
                }

            }

            
            base.Update(gameTime);
        }

        
        public override void Draw(SpriteBatch spriteBatch)
        {
                spriteBatch.Draw(texture, new Rectangle((int)position.X, (int)position.Y, spriteWidth, spriteHeight), spriteRect, Color.White, 0, Vector2.Zero, invertido, 1);
                base.Draw(spriteBatch);
           
        }

    }
}
